/*
 * FileName: AttachTest.java
 * Author:   zzw
 * Date:     2018年10月30日
 * Description:
 */
package com.zzw.hotspot.attach;

import com.sun.tools.attach.AgentInitializationException;
import com.sun.tools.attach.AgentLoadException;
import com.sun.tools.attach.AttachNotSupportedException;
import com.sun.tools.attach.VirtualMachine;

import java.io.IOException;
import java.util.Properties;

/**
 * 〈〉<br>
 * 〈〉
 *
 * @author zzw
 * @see [相关类/方法]（可选）
 * @since [产品/模块版本]（可选）
 */
public class AttachTest {

    public static void main(String[] args)
            throws AttachNotSupportedException, IOException, AgentLoadException, AgentInitializationException {
       /* if (args.length <= 1) {
            System.out.println("Usage: java AttachTest <PID> /PATH/TO/AGENT.jar");
            return;
        }*/
        VirtualMachine vm = VirtualMachine.attach(args[0]);
        Properties properties = vm.getSystemProperties();
        int size = properties.size();
        System.out.println(size);
        //vm.loadAgent(args[1]);
        System.exit(0);
    }
}
